    WebFreeCall = {
        web_freecall_server: "http://freecall.3jia5.com/index.php",
        isLockBtn: false,
        web_freecall_phone_input: null,
        web_freecall_call_button: null,
        web_freecall_prompt_box: null,
        web_freecall_callfomat_box: null,

        init: function () {
            this.web_freecall_phone_input = document.getElementById('web_freecall_phone_input');
            this.web_freecall_call_button = document.getElementById('web_freecall_call_button');
            this.web_freecall_prompt_box = document.getElementById('web_freecall_prompt_box');
            this.web_freecall_callfomat_box = document.getElementById('web_freecall_callfomat_box');

            this.web_freecall_call_button.onclick = function () {
                try {
                    if (!WebFreeCall.isLockBtn)
                        WebFreeCall.call();
                } catch (e) {
                    this.web_freecall_prompt_box = '发生程序异常' + e;
                }
            }
        },
        valid: function (phone) {
            if (phone && phone.length == 0) {
                return false;
            } else if (!/^\d+$/.test(phone)) {
                return false;
            } else if (/^1[34578]\d{9}$/.test(phone)) {
                return true;
            } else if (/^0\d{2,3}\d{7,8}$/.test(phone)) {
                return true;
            } else if (/^008\d{2}\d{7,8}$/.test(phone)) {
                return true;
            } else {
                return false;
            }
        },
        inputBlur: function (o) {
            if (!this.valid(o.value))
                WebFreeCall.web_freecall_prompt_box.innerHTML = '电话/手机号码 输入错误！';
            else
                WebFreeCall.web_freecall_prompt_box.innerHTML = '';
        },
        inputKeyUp: function (o) {
            if (!/^\d+$/.test(o.value))
                o.value = '';
        },
        inputKeyDown: function (o) {
            if (o.value == '输入电话/手机号码')
                o.value = '';
        },
        inputMouseOver: function (o, e) {
            var x, y;
            e = e || window.event;
            x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
            y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
            var a = WebFreeCall.web_freecall_callfomat_box;
            if (a) {
                a.style.display = 'block';
                a.style.left = 'calc(50% - 100px)';
                a.style.top = 'calc(50% + 15px)';
            }
        },
        inputMouseOut: function (o) {
            var a = WebFreeCall.web_freecall_callfomat_box;
            if (a)
                a.style.display = 'none';
        },
        getCookieVal: function (offset) {
            var endstr = document.cookie.indexOf(";", offset);
            if (endstr == -1) {
                endstr = document.cookie.length;
            }
            return this.strip_tags(unescape(document.cookie.substring(offset, endstr)));
        },
        strip_tags: function (input, allowed) {
            allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('');
            var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
                commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
            return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
                return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
            });
        },
        getCookie: function (name) {
            var arg = name + "=";
            var alen = arg.length;
            var clen = document.cookie.length;
            var i = 0;
            while (i < clen) {
                var j = i + alen;
                if (document.cookie.substring(i, j) == arg) {
                    return this.getCookieVal(j);
                }
                i = document.cookie.indexOf(" ", i) + 1;
                if (i == 0) {
                    break;
                }
            }
            return "";
        },
        call: function () {
            var c = web_freecall_company;
            var t = this.web_freecall_phone_input.value;
            var i = web_freecall_itemid == 'undefined' ? 0 : web_freecall_itemid;

            if (!this.valid(t)) {
                WebFreeCall.web_freecall_prompt_box.innerHTML = '电话/手机号输入有误！';
                return;
            }

            var ks = this.getCookie("_J_SITE");
            var so = this.getCookie("_J_SOURCE");
            var cp = window.location.href;
            var nl = this.getCookie("_J_NL");

            var url = this.web_freecall_server + '/call?CB=WebFreeCall.callResult&' + 'C=' + c + '&T=' + t + '&I=' + i + '&KS=' + ks + '&SO=' + so + '&CP=' + cp + '&NL=' + nl;

            this.jsonp(url, 'WebFreeCallCallResultId');
            this.web_freecall_prompt_box.innerHTML = '正在呼叫中...';
            this.isLockBtn = true;
        },
        callResult: function (res) {
            var prompt = '呼叫失败!';
            if (res == 1) {
                prompt = '电话暂时无法接通，请稍候再拨!';
            } else if (res == 2) {
                prompt = '呼叫成功，如有来电，请接听...';
            } else if (res == 3) {
                prompt = '免费电话未认证!';
            } else if (res == 4) {
                prompt = '电话暂时无法接通，请稍候再拨!';
            } else if (res == 5) {
                prompt = '您的呼叫过于频繁，请休息一下!';//'您的ip已超过呼叫限制次数!';
            } else if (res == 6) {
                prompt = '您的呼叫过于频繁，请休息一下!';//'您的电话已超过呼叫限制次数!';
            } else if (res == 7) {
                prompt = '呼叫失败!';
            }
            WebFreeCall.web_freecall_prompt_box.innerHTML = prompt;
            WebFreeCall.isLockBtn = false;
        },
        jsonp: function (uri, id) {
            var jsonpId = document.getElementById(id);
            if (jsonpId)
                jsonpId.parentNode.removeChild(jsonpId);
            elem = document.createElement('script');
            elem.onload = elem.onreadystatechange = function () {
                if (!!!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
                    elem.onload = elem.onreadystatechange = null
                }
            }
            if (id)
                elem.id = id;
            elem.type = 'text/javascript';
            var rcode = Math.floor(Math.random() * 99999999);
            if (uri.indexOf('?') > 0) uri += '&' + rcode;
            else uri += '?' + rcode;
            elem.src = uri;

            document.getElementsByTagName('head')[0].appendChild(elem);
        }
    }